//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;

namespace OpenLS.Spreadsheet.Expressions
{
    class SingleCellRangeReference: CellsRangeReference
    {
        
        private readonly CellReference _cellReference;

        public SingleCellRangeReference(CellReference cellReference)
        {
            _cellReference = cellReference;
        }

        public override CellReference TopLeft
        {
            get { return this._cellReference; }
        }
        public override CellReference BottomRight
        {
            get { return _cellReference; }
        }

        protected override Range CreateRange()
        {
            return Range.Create(Worksheet, new RangeAddress(_cellReference.Address, _cellReference.Address), false);
        }

        public override Worksheet Worksheet
        {
            get { return _cellReference.Worksheet; }
        }

        public override string Label
        {
            get { return _cellReference.Label; }
        }

        protected override Range GetRange()
        {
            return CreateRange();
        }

        public override RangeReference Offset(CellRelativeAddress address)
        {
            return new SingleCellRangeReference(_cellReference.Offset(address));
        }

        internal override RangeReference Transposed(Cell target)
        {
            return new SingleCellRangeReference(_cellReference.Transposed(target));
        }

        internal override RangeReference Projected(Worksheet targetWorksheet)
        {
            return new SingleCellRangeReference(this._cellReference.Projected(targetWorksheet));
        }
    }
}